
using Abp.Domain.Repositories;
using Microsoft.EntityFrameworkCore;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;


namespace SOEI.Solution.DomainEntities.RoomSourceVerifiyV1.DomainService
{
    /// <summary>
    /// 领域服务层一个模块的核心业务逻辑
    ///</summary>
    public class CommissionContractDigestManager : DomainServiceBase, ICommissionContractDigestManager
    {

        private readonly IRepository<CommissionContractDigest, string> _commissioncontractdigestRepository;

        /// <summary>
        /// 【CommissionContractDigest】的构造方法
        /// 通过构造函数注册服务到依赖注入容器中
        ///</summary>
        public CommissionContractDigestManager(IRepository<CommissionContractDigest, string> commissioncontractdigestRepository)
        {
            _commissioncontractdigestRepository = commissioncontractdigestRepository;
        }

        #region -------------------------------------------------辅助工具生成---------------------------------------------- 

        /// <summary>
        /// 返回列表查询用
        /// </summary>
        /// <returns></returns>
        public IQueryable<CommissionContractDigest> QueryEntityListAsNoTracking()
        {

            var query = _commissioncontractdigestRepository.GetAll().AsNoTracking()
                        .Select(x => new CommissionContractDigest
                        {

                            Id = x.Id,
                            STRJJJG = x.STRJJJG,
                            JJJGBAH = x.JJJGBAH,
                            WTHTDJH = x.WTHTDJH,
                            CQZH = x.CQZH,
                            JZMJ = x.JZMJ,
                            ZCS = x.ZCS,
                            SZC = x.SZC,
                            HX = x.HX,
                            CX = x.CX,
                            ZXQK = x.ZXQK,
                            WTSJ = x.WTSJ,
                            WTQX = x.WTQX,
                            WTFS = x.WTFS,
                            HTFS = x.HTFS,
                            LRSJ = x.LRSJ,
                            TJSJ = x.TJSJ,
                            WTHTZTDM = x.WTHTZTDM,
                            WTHTBLZTDM = x.WTHTBLZTDM,
                            CQZBH = x.CQZBH,
                            JJRYBH = x.JJRYBH,
                            JJRYXBRBH = x.JJRYXBRBH,
                            CQZDDCQ = x.CQZDDCQ,
                            WTJZRQ = x.WTJZRQ,
                            YJ = x.YJ,
                            YJBZDM = x.YJBZDM,
                            SFZLDM = x.SFZLDM,
                            ZLXX = x.ZLXX,
                            YJBFB = x.YJBFB,
                            SFDY = x.SFDY,
                            JJRYMC = x.JJRYMC,
                            ISNEW = x.ISNEW,
                            BSM_BDCQZ = x.BSM_BDCQZ,
                            WTRXM = x.WTRXM,
                            WTRZJHM = x.WTRZJHM,
                        });
            return query;
        }

        /// <summary>
        /// 【CommissionContractDigest】返回表达式数的实体信息即IQueryable类型
        /// </summary>
        /// <returns>IQueryable</returns>
        public IQueryable<CommissionContractDigest> Query()
        {
            return _commissioncontractdigestRepository.GetAll();
        }
        /// <summary>
        /// 【CommissionContractDigest】返回即IQueryable类型的实体，不包含EF Core跟踪标记
        /// </summary>
        /// <returns>IQueryable</returns>
        public IQueryable<CommissionContractDigest> QueryAsNoTracking()
        {
            return _commissioncontractdigestRepository.GetAll().AsNoTracking();
        }
        /// <summary>
        /// 【CommissionContractDigest】根据Id查询实体信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns>实体</returns>
        public async Task<CommissionContractDigest> FindByIdAsync(string id)
        {
            var entity = await _commissioncontractdigestRepository.GetAsync(id);
            return entity;
        }
        /// <summary>
        /// 【CommissionContractDigest】检查实体是否存在
        /// </summary>
        /// <param name="id"></param>
        /// <returns>bool</returns>
        public async Task<bool> IsExistAsync(string id)
        {
            var result = await _commissioncontractdigestRepository.GetAll().AnyAsync(a => a.Id == id);
            return result;
        }
        /// <summary>
        /// 【CommissionContractDigest】创建实体
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public async Task<CommissionContractDigest> CreateAsync(CommissionContractDigest entity)
        {
            entity.Id = await _commissioncontractdigestRepository.InsertAndGetIdAsync(entity);
            return entity;
        }
        /// <summary>
        /// 【CommissionContractDigest】更新实体
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public async Task UpdateAsync(CommissionContractDigest entity)
        {
            await _commissioncontractdigestRepository.UpdateAsync(entity);
        }
        /// <summary>
        /// 【CommissionContractDigest】删除实体
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public async Task DeleteAsync(string id)
        {
            //TODO:删除前的逻辑判断，是否允许删除
            await _commissioncontractdigestRepository.DeleteAsync(id);
        }
        /// <summary>
        /// 【CommissionContractDigest】批量删除
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task BatchDelete(List<string> input)
        {
            //TODO:删除前的逻辑判断，是否允许删除
            await _commissioncontractdigestRepository.DeleteAsync(a => input.Contains(a.Id));
        }
        #endregion


        #region -------------------------------------------------用户自定义------------------------------------------------
        /*请在此扩展领域服务接口*/
        #endregion









    }
}
